<?php
include('../../inc/global.inc');
include("../islogin.php");
$page=$_GET['page']?$_GET['page']:1;
$maxpage=20;
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
<script src="../../js/jquery.js"></script>
</HEAD>
<BODY>
<center>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">托管列表&nbsp;&nbsp;<a href="javascript:history.go(-1)">Back</a></td>
    </tr>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
        <tr>
          <td width="5%" height="30" align="center" bgcolor="#EFF6FF">编号</td>
          <td width="20%" align="center" bgcolor="#EFF6FF">产品名称</td>
          <td width="12%" align="center" bgcolor="#EFF6FF">申请时间</td>
          <td width="12%" align="center" bgcolor="#EFF6FF">买家</td>
          <td width="12%" align="center" bgcolor="#EFF6FF">卖家</td>
          <td  align="center" bgcolor="#EFF6FF">管理操作</td>
        </tr>
		<?php
			$where ="where 1";
			$sql="select * from sd_tuoguan $where order by id desc limit ".($page-1)*$maxpage.",$maxpage";
			$rows=$db->select($sql);
			$i=1;
			foreach($rows as $k=>$row)
			{
		?>
        <tr>
          <td height="22" align="center" bgcolor="#FFFFFF"><?=$row['id']?></td>
          <td align="center" bgcolor="#FFFFFF"><a href="<?=$row['url']?>" target="_blank"><?=$row['title']?></a></td>
          <td align="center" bgcolor="#FFFFFF"><?=date("Y-m-d",$row['inputtime'])?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['username']?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['username2']?></td>
          <td align="center" bgcolor="#FFFFFF">
          <?php 
		  if($row['status']==7)
		  {
		  	echo '卖家交易关闭';
		  }
		  elseif($row['status']==0)
		  {
		  ?>
          等待卖家确定
		  <?php 
		  }
		  elseif($row['status']==1)
		  {
		  
          	echo '卖家确认托管交易，<a>请打款</a>';
          }
		  elseif($row['status']==2)
		  {
		  
          	echo '管理员<a href="shoukuan.php?id='.$row['id'].'">确认收款</a>';
          }
		  elseif($row['status']==3)
		  {
		  
          	echo '三帝已收款，提醒卖家发货。';
          }
		  elseif($row['status']==4)
		  {
		  
          	echo '卖家已发货。买家<a>确定收货</a>';
          }
		  elseif($row['status']==5)
		  {
		  
          	echo '买家已确认收货，管理员打款给卖方，<a href="queren.php?id='.$row['id'].'">打款</a>';
          }
		  elseif($row['status']==6)
		  {
		  
          	echo '交易成功';
          }
		  echo '&nbsp;&nbsp;<a href="liucheng.php?id='.$row['id'].'">查看流程</a>';
		  ?>
          
          </td>
        </tr>
<?php
$i++;
}
$number = $db->get_one("SELECT count(*) AS `count` FROM `sd_tuoguan` $where");
?>

        <tr>
          <td colspan="6" align="center" bgcolor="#FFFFFF" height="18">
          <?php echo showpages($number['count'], $page, $maxpage);?>          </td>
        </tr>
    </table>
</center>
</BODY>
</HTML>